version: 0.16.0-{build}
platform:
  - x64
environment:
  RUST_INSTALL_DIR: C:\Rust
  RUSTFLAGS: "-D warnings"
  matrix:
    - RUST_INSTALL_TRIPLE: x86_64-pc-windows-msvc
      RUST_VERSION: stable
    - RUST_INSTALL_TRIPLE: x86_64-pc-windows-msvc
      RUST_VERSION: stable
      PACKAGE: win
      FTP_PASSWD:
        secure: DBE4nt5J/zQUXTGe8QTOJg==
install:
  # Rust & Qt
  - set PATH=%USERPROFILE%\.cargo\bin;%PATH%
  - set QTDIR=C:\Qt\5.4\msvc2013_64_opengl
  - set PATH=%QTDIR%\bin;%PATH%
  - set CMAKE_PREFIX_PATH=%QTDIR%;%CMAKE_PREFIX_PATH%
  - appveyor DownloadFile https://static.rust-lang.org/rustup/dist/%RUST_INSTALL_TRIPLE%/rustup-init.exe
  - if defined APPVEYOR_PULL_REQUEST_TITLE (
      if NOT defined PACKAGE (
        rustup-init.exe -y
      )
    ) else (
      rustup-init.exe -y
    )
build_script:
  - call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64
  - if NOT DEFINED PACKAGE (
      cargo build --verbose
    ) else (
      if NOT DEFINED APPVEYOR_PULL_REQUEST_TITLE (
        if "%PACKAGE%"=="win" (
          cd pkg\windows &
          call package_zip.bat &
          curl -T panopticon-0.16.zip -u upload:%FTP_PASSWD% -Q "-SITE CHMOD 664 panopticon-master.zip" ftp://files.panopticon.re/panopticon-master.zip
        )
      )
    )
test_script:
  - if NOT DEFINED PACKAGE (
      call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64 &
      cargo test --verbose --all
    )
